﻿namespace Web.Control.WWW.Learn
{

    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using Lx.Web.Common.ControlsUI;
    using System.Collections.Generic;
    using System.Collections;
    using BLF.WWW_WWW.Learn;
    using Model.WWW_User.LearnComment;
    /// <summary>
    /// CommentList 的摘要说明
    /// </summary>
    public class CommentList : BaseControl
    {
        /// <summary>
        /// 学习语言
        /// </summary>
        protected string learnVal = "";      
       
        /// <summary>
        /// 当前会员号
        /// </summary>
        protected string memberNo = "";
        protected Repeater cList;
        protected Literal litScript;
        private int pageIndex = 1;
        private int pageSize = 20;
        protected override void OnLoad(EventArgs e)
        {
            memberNo = HttpContext.Current.User.Identity.Name;
            if (Request["learn"] != null && !String.IsNullOrEmpty(Request["learn"].ToString()))
            {
                learnVal = Request["learn"].ToString();
            }
            else
            {
                Response.End();
            }
            int commentCount;
            List<LearnCommentModel> commentList = Learn.GetLearnMembersAndComment(learnVal, pageIndex, pageSize, out commentCount);
            if (cList != null)
            {
                cList.DataSource = commentList;
                cList.DataBind();
            }
            if (litScript != null)
            {
                litScript.Text = "<script>var memberno='" + memberNo;
                litScript.Text += "';var learnL='" + learnVal;
                litScript.Text += "';var commentPage=" + (new System.Web.Script.Serialization.JavaScriptSerializer()).Serialize(new BLF.PageableObject(commentCount, pageIndex, pageSize)) + ";</script>";
            }
			((Lx.Web.Common.UI.TDTPageBase)this.Page).DynamicTitle=GetText("LN500").Replace("{0}", GetLanguageText(learnVal));
            base.OnLoad(e);
        }
    }
}
